import request from '@/utils/request'

/**
 * 获取组织架构的数据
 */
export const reqGetDepartments = () => {
  return request({
    method: 'get',
    url: '/company/department'
  })
}

/**
 * 删除部门
 * @param {*} id 部门id
 */
export const reqDelDepartment = (id) => {
  return request({
    method: 'delete',
    url: '/company/department/' + id
  })
}
/**
 * 新增部门
 * @param {*} data 部门信息
 */
export const reqAddDepartment = (data) => {
  return request({
    method: 'post',
    url: '/company/department',
    data
  })
}

/**
 * 获取部门详情
 * @param {*} id 部门的id
 * @returns
 */
export const reqGetDetailDepart = (id) => {
  return request({
    method: 'get',
    url: `/company/department/${id}`
  })
}

export const reqUpdateDepartment = (data) => {
  return request({
    method: 'put',
    url: `/company/department/${data.id}`,
    data
  })
}
